package com.rois.librois.RoIS;

import com.rois.librois.RoIS.EventIF;
import com.rois.librois.RoIS.EventIFHelper;


/**
* RoIS/EventIFPOA.java .
* IDL-to-Java コンパイラ (ポータブル), バージョン "3.1" で生成
* 生成元: RoIS_IDL.idl
* 2011年9月8日 0時05分18秒 JST
*/


/******************************************
* For Event Interface
******************************************/
public abstract class EventIFPOA extends org.omg.PortableServer.Servant
 implements com.rois.librois.RoIS.EventIFOperations, org.omg.CORBA.portable.InvokeHandler
{

  // Constructors

  private static java.util.Hashtable _methods = new java.util.Hashtable ();
  static
  {
    _methods.put ("subscribe", new java.lang.Integer (0));
    _methods.put ("unsubscribe", new java.lang.Integer (1));
    _methods.put ("get_event_detail", new java.lang.Integer (2));
  }

  public org.omg.CORBA.portable.OutputStream _invoke (String $method,
                                org.omg.CORBA.portable.InputStream in,
                                org.omg.CORBA.portable.ResponseHandler $rh)
  {
    org.omg.CORBA.portable.OutputStream out = null;
    java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
    if (__method == null)
      throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

    switch (__method.intValue ())
    {
       case 0:  // RoIS/EventIF/subscribe
       {
         String servername = in.read_string ();
         String event_type = in.read_string ();
         String condition = com.rois.librois.RoIS.Condition_tHelper.read (in);
         org.omg.CORBA.StringHolder subscribe_id = new org.omg.CORBA.StringHolder ();
         com.rois.librois.RoIS.ReturnCode_t $result = null;
         $result = this.subscribe (servername, event_type, condition, subscribe_id);
         out = $rh.createReply();
         com.rois.librois.RoIS.ReturnCode_tHelper.write (out, $result);
         out.write_string (subscribe_id.value);
         break;
       }

       case 1:  // RoIS/EventIF/unsubscribe
       {
         String servername = in.read_string ();
         String subscribe_id = in.read_string ();
         com.rois.librois.RoIS.ReturnCode_t $result = null;
         $result = this.unsubscribe (servername, subscribe_id);
         out = $rh.createReply();
         com.rois.librois.RoIS.ReturnCode_tHelper.write (out, $result);
         break;
       }

       case 2:  // RoIS/EventIF/get_event_detail
       {
         String servername = in.read_string ();
         String event_id = in.read_string ();
         String condition = com.rois.librois.RoIS.Condition_tHelper.read (in);
         com.rois.librois.RoIS.ResultListHolder results = new com.rois.librois.RoIS.ResultListHolder ();
         com.rois.librois.RoIS.ReturnCode_t $result = null;
         $result = this.get_event_detail (servername, event_id, condition, results);
         out = $rh.createReply();
         com.rois.librois.RoIS.ReturnCode_tHelper.write (out, $result);
         com.rois.librois.RoIS.ResultListHelper.write (out, results.value);
         break;
       }

       default:
         throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
    }

    return out;
  } // _invoke

  // Type-specific CORBA::Object operations
  private static String[] __ids = {
    "IDL:RoIS/EventIF:1.0"};

  public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
  {
    return (String[])__ids.clone ();
  }

  public EventIF _this() 
  {
    return EventIFHelper.narrow(
    super._this_object());
  }

  public EventIF _this(org.omg.CORBA.ORB orb) 
  {
    return EventIFHelper.narrow(
    super._this_object(orb));
  }


} // class EventIFPOA
